﻿<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>@ViewBag.Title-AISUN</title>
    <link rel="icon" href="/res/images/logo.png" />
    <link rel="stylesheet" href="/res/layuiadmin/layui/css/layui.css?v=2.7.6" media="all">
    <link rel="stylesheet" href="/res/layuiadmin/style/admin.css" media="all">
    @RenderSection("Contents", false)
    <script src="/res/vue/vue.min.js"></script>
</head>
<body>
    @RenderBody()

    <script src="/res/layuiadmin/layui/layui.js?v=2.7.6"></script>
    <script src="/res/jquery/jquery-1.10.2.min.js"></script>
    <script>
        layui.config({
            base: '/res/layuiadmin/'
        }).extend({
            index: 'lib/index'
        }).use(['form'], function () {
            layui.form.verify({
                validNum: function (value, item) {
                    if (value.trim() == '' || parseFloat(value.trim()) <= 0) {
                        return "数字必须大于0";
                    }
                }
            });
        });
        jQuery.ajaxSetup({
            type: "POST",
            dataType: "JSON",
        });
        function timestampToTimes(timestamp) {
            if (!timestamp || timestamp.trim() == '') {
                return "";
            }
            timestamp = timestamp.substring(timestamp.indexOf('(') + 1, timestamp.lastIndexOf(')'));
            var date = new Date(parseInt(timestamp));
            var Y = date.getFullYear() + '-';
            var M = (date.getMonth() < 9 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)) + '-';
            var D = (date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate()) + ' ';
            var h = (date.getHours() < 10 ? ("0" + date.getHours()) : date.getHours()) + ':';
            var m = (date.getMinutes() < 10 ? ("0" + date.getMinutes()) : date.getMinutes()) + ':';
            var s = (date.getSeconds() < 10 ? ("0" + date.getSeconds()) : date.getSeconds());
            return Y + M + D + h + m + s;
        }
        function timestampToTime(timestamp) {
            var time = timestampToTimes(timestamp);
            return time.substring(0, 16);
        }
        function timestampToDate(timestamp) {
            var time = timestampToTimes(timestamp);
            return time.substring(0, 10);
        }
        function getParameter(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]); return null;
        }

        var lang = localStorage.getItem("lang");
        if (!lang && location.href.indexOf("/Auth/Login") < 0) {
            window.parent.location.href = "/Auth/Login";
        }

        $(document).on("click", ".btnPreDuty, .btnNextDuty", function () {
            GetSideDutyTime($("#txtRangeTime").val().trim(), $(this).hasClass("btnNextDuty"), function (timeRange) {
                $("#txtRangeTime").val(timeRange);
            });
        });
        function GetSideDutyTime(timeRange, isNextDuty, callback) {
            $.ajax({
                url: "/Common/GetSideDutyTime?timeRange=" + timeRange + "&isNextDuty=" + isNextDuty,
                type: "GET",
                success: function (res) {
                    if (callback) {
                        callback(res.TimeRange)
                    }
                }
            });
        }
    </script>
    @RenderSection("Scripts", false)
</body>
</html>
